import { loginMessages } from './login';
import { authorityMessages } from './authority';
import { systemMessages } from './system';
import { businessMessages } from './business';
import { singleSystemMessages } from './singleSystem';

// 语言配置
export const languages = [
  { value: "Deutsch", label: "Deutsch", code: "de" },
  { value: "Français", label: "Français", code: "fr" },
  { value: "Nederlands", label: "Nederlands", code: "nl" },
  { value: "English", label: "English", code: "en" },
  { value: "Svenska", label: "Svenska", code: "sv" }
];

// 语言映射
export const languageMap: Record<string, string> = {
  "Deutsch": "de",
  "Français": "fr", 
  "Nederlands": "nl",
  "English": "en",
  "Svenska": "sv"
};

// 获取消息的工具函数
export const getMessages = (currentLanguage: string) => {
  const langKey = languageMap[currentLanguage] || "en";
  return allMessages[langKey as keyof typeof allMessages];
};

// 合并所有模块的消息
export const allMessages = {
  en: {
    ...loginMessages.en,
    ...systemMessages.en,
    ...businessMessages.en,
    ...singleSystemMessages.en,
    // 将权限模块命名空间收敛到 authority 下，调用时使用 t('authority.xxx')
    authority: authorityMessages.en,
  },
  de: {
    ...loginMessages.de,
    ...businessMessages.de,
    ...singleSystemMessages.de,
    authority: authorityMessages.de,
  },
  fr: {
    ...loginMessages.fr,
    ...businessMessages.fr,
    ...singleSystemMessages.fr,
    authority: authorityMessages.fr,
  },
  nl: {
    ...loginMessages.nl,
    ...businessMessages.nl,
    ...singleSystemMessages.nl,
    authority: authorityMessages.nl,
  },
  sv: {
    ...loginMessages.sv,
    ...businessMessages.sv,
    ...singleSystemMessages.sv,
    authority: authorityMessages.sv,
  }
}; 